/**
 * 字典数据接口
 */

import { Get, Post, Delete, Put, RequestParams, ResponseData } from '../../common/decorator'


export default class DictDataService {

  /**
   * 查询字典数据列表
   * @param res 
   * @returns 
   */
  @Get("/system/dict/data/list", { requestType: 'params' })
  listData(res: object) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  // 根据字典编码获取字典数据信息
  @Get("/system/dict/data/${dictCode}", { requestType: 'path' })
  getData(res: { dictCode: any }) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  // 根据字典类型查询字典数据信息
  @Get("/system/dict/data/type/${dictType}", { requestType: 'path' })
  getDicts(res: { dictType: any }) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  // 新增字典数据
  @Post("/system/dict/data", { requestType: 'data' })
  addData(res: object) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  // 修改字典数据
  @Put("/system/dict/data", { requestType: 'data' })
  updateData(res: object) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }

  @Delete("/system/dict/data/${dictCode}", { requestType: 'path' })
  delData(res: any) {
    const convertedResult: unknown = res as unknown;
    return convertedResult as Promise<ResponseData>
  }
}